package orm.jpa.first.datasource.support;

import org.springframework.util.Assert;

public class DataSourceTypeHolder {
	
	private static final ThreadLocal<DataSourceType> holder = new ThreadLocal<DataSourceType>();
	
	public static void setDataSourceType(DataSourceType dataSourceType) {
		Assert.notNull(dataSourceType, "dataSourceType cannot be null");
		holder.set(dataSourceType);
	}
	
	public static DataSourceType getDataSourceType() {
		return holder.get();
	}
	
	public static void clearDataSourceType() {
		holder.remove();
	}
}
